package com.rt.easyjava.common.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
  * @author wuxiaoyong
  * @since 2020-07-01
 */
public enum VpLgNature {
    ParkingLot(1, "停车场"),
    ParkingGarageGrd(2, "地上停车库"),
    ParkingGarageUgrd(3, "地下停车库 "),
    MechanicalParkingGrd(4, "地上机械停车"),
    MechanicalParkingUgrd(5, "地下机械停车");

    private final Integer id;
    private final String name;

    VpLgNature(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public static String explain(Integer id) {
        return explain(id, null) ;
    }

    public static String explain(Integer id, String unexpectedValue) {
        for (VpLgNature enum1 : VpLgNature.values()) {
            if (enum1.id.equals(id)) {
                return enum1.getName();
            }
        }
        return unexpectedValue;
    }

    public static List<Map<String,Object>> toList () {
        List <Map<String,Object>> list = new ArrayList();
        for (VpLgNature enum1 : VpLgNature.values()) {
            Map<String,Object> map = new HashMap();
            map.put("id", enum1.getId());
            map.put("name", enum1.getName());
            list.add(map);
        }
        return list;
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

}
